package com.example.lishop.repository

import com.example.lishop.entity.BProductTypeEntity
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import org.springframework.transaction.annotation.Transactional
import java.util.*

/**
 * Created on 2021/3/14 18:00
 * @author shuguo
 */
interface ProductTypeRepository : JpaRepository<BProductTypeEntity, Int>{

    fun findByProductTypeId(depId: String): BProductTypeEntity?

    @Transactional(timeout = 10)
    @Modifying
    @Query("update BProductEntity set sts = '1' where productId = ?1")
    fun del(productId: String)

    @Transactional(timeout = 10)
    @Modifying
    @Query("update BProductTypeEntity set name = :name, descript = :descript, sts = :sts where productTypeId = :productTypeId")
    fun update(productTypeId:String, name:String, descript:String, sts:String)
}